
clear
use "C:\Papers\New papers\John Cronyism\Italy\Bilanci0.dta", clear
summarize
replace Anno=nno if Anno==.
drop nno
replace Anno=anno if Anno==.
drop anno
replace Anno=Year if Anno==.
drop ANNO Aittivo 
drop Stocks W Y
drop Year Id ID
drop B C D E F G H I J K L M N O P Q S T U Active AssetsMat Titles 
drop Oblig 
drop Payablesdiv 
drop ProfitLoss 
drop A vb Cashandcredits Provisions Reserves Adm R V X Z AA AB AC AD AE AF 
duplicates drop id Anno, force
save "C:\Papers\New papers\John Cronyism\Italy\Bilanci.dta", replace
clear

clear
import excel "C:\Papers\New papers\John Cronyism\Italy\SocietaItaliane.xlsx", sheet("Lista Societa") firstrow
rename IdOrigine id
drop IdSocietà
rename Benchmark Anno
tabulate Anno
drop if Anno=="1972 [ATTIVO 1971]"
drop if Anno=="1983 [ATTIVO 1982]"
drop if Anno=="FB"
destring Anno, replace
duplicates drop id Anno, force
save "C:\Papers\New papers\John Cronyism\SocietaItaliane.dta", replace
clear

clear
import excel "C:\Papers\New papers\John Cronyism\Italy\Market Capitalizations Mediobanca Indici e Dati.xlsx", sheet("Sheet1") firstrow
drop if id==.
reshape long Anno, i( id ) j(Year)
summarize
rename Anno MktCapMillions
rename Year Anno
replace MktCapMillions=. if Anno<1933
save "C:\Papers\New papers\John Cronyism\Italy\Market Capitalizations Mediobanca.dta", replace
clear


/* Prices from il sole 24 ore for MB ratios*/
clear
import excel "C:\Papers\New papers\John Cronyism\Italy\Sole 24 Ore Stock Prices for MB Ratios.xlsx", sheet("Sheet1") firstrow
drop if id==.
reshape long NumberSole ValoreNominale Price PriceType, i( id ) j(Year)
summarize
gen MBSole=Price/ ValoreNominale
summarize MBSole
summarize MBSole, detail
sort Year id
rename Year  Anno
save "C:\Papers\New papers\John Cronyism\Italy\Sole 24 Ore Stock Prices for MB Ratios.dta", replace
clear


/*This file has data on all municipalities and their provinces*/
clear
import excel "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\Comuni and Province.xlsx", sheet("Sheet1") firstrow
drop if Province==""
gen OldSede=Sede if COMUNEATTUALE!=""
duplicates drop Sede, force
gen ID=_n
gen Sede1 =Sede
replace Sede = subinstr(Sede , "(", "", .)
replace Sede = subinstr(Sede , ")", "", .)
sort Sede
save "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\Comuni and Province.dta", replace
clear

clear
import excel "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\ISTAT Dati comunali e provinciali.xlsx", sheet("Province rearranged") firstrow
drop if Prov==""
save "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\ISTAT popolazione province.dta", replace
clear

/*This file has data on the surface and population of towns and provinces in 2011 from Istat*/
clear
import excel "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\ISTAT Dati comunali e provinciali.xlsx", sheet("Dati comunali") firstrow
summarize
drop CodiceRegione DenominazioneComune CodiceProvincia DenominazioneComune Classidisuperficietotalein Densitàabitativaabitantiper
replace Sede = subinstr(Sede , "(", "", .)
replace Sede = subinstr(Sede , ")", "", .)
duplicates drop Sede, force
gen ID1=_n
save "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\ISTAT Dati comunali e provinciali.dta", replace
clear

/*This file has data on allied bombings during 1943-1945 from THOR*/
clear
import delimited "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\THOR_WWII_DATA_CLEAN.csv"
keep if tgt_country=="ITALY"
replace tgt_location= citynamegooglemaps
replace tgt_location="MILANO" if tgt_location=="MILAN"
replace tgt_location="LATINA" if tgt_location=="LITTORIA"
replace tgt_location="TORINO" if tgt_location=="TURIN"
replace tgt_location="ROMA" if tgt_location=="ROME"
replace tgt_location="GENOVA" if tgt_location=="GENOA"
replace tgt_location="NAPOLI" if tgt_location=="NAPLES"
replace tgt_location="LIVORNO" if tgt_location=="LEGHORN"
replace tgt_location="ISOLA DI LAMPEDUSA" if tgt_location=="LAMPEDUSA ISLAND"
replace tgt_location="APPIANO GENTILE" if tgt_location=="APPIANO"
replace tgt_location="BAGNARA CALABRA" if tgt_location=="BAGNARA"
replace tgt_location="BRESCIA" if tgt_location=="BRESCIA E M/Y"
replace tgt_location="BRESCIA" if tgt_location=="BRESCIA M/Y"
replace tgt_location="BRESCIA" if tgt_location=="BRESCIA W M/Y"
replace tgt_location="CALTANISSETTA" if tgt_location=="CALTANISETTA"
replace tgt_location="CANCELLO ED ARNONE" if tgt_location=="CANCELLO"
replace tgt_location="CANICATTÌ" if tgt_location=="CANICATTI"
replace tgt_location="CAVA DEI TIRRENI" if tgt_location=="CAVA DI TIRRENI"
replace tgt_location="FIRENZE" if tgt_location=="FLORENCE"
replace tgt_location="FORLÌ" if tgt_location=="FORLI"
replace tgt_location="PATERNÒ" if tgt_location=="PATERNO"
replace tgt_location="REGGIO CALABRIA" if tgt_location=="REGGIO DI CALABRIA"
replace tgt_location="ROMANO DI LOMBARDIA" if tgt_location=="ROMANO DI LOMBARDI"
replace tgt_location="SESTO SAN GIOVANNI" if tgt_location=="SESTO SAN GIVANNI"
replace tgt_location="VENEZIA" if tgt_location=="VENICE"
replace tgt_location="VILLA SAN GIOVANNI" if tgt_location=="VILLA S. GIOVANNI"
collapse (sum) total_tons, by(tgt_location)
rename tgt_location  Sede
compress Sede
replace Sede = subinstr(Sede , "(", "", .)
replace Sede = subinstr(Sede , ")", "", .)
gen ID2=_n
merge m:1 Sede using "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\Comuni and Province.dta"
drop if _merge==2
drop _merge
drop if Sede==""
save "C:\Papers\New papers\John Cronyism\Italy\THOR_WWII_DATA_CLEAN.dta", replace
/*This below is built in case we are asked to aggregate differently*/
drop if Province==""
collapse (sum) total_tons, by(Province)
gen total_tons_province=total_tons
drop total_tons
rename Province Prov
save "C:\Papers\New papers\John Cronyism\Italy\THOR_WWII_DATA_CLEAN_Province.dta", replace
clear

clear
import delimited "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\THOR_WWII_DATA_CLEAN.csv"
keep if tgt_country=="ITALY"
replace tgt_location= citynamegooglemaps
replace tgt_location="MILANO" if tgt_location=="MILAN"
replace tgt_location="LATINA" if tgt_location=="LITTORIA"
replace tgt_location="TORINO" if tgt_location=="TURIN"
replace tgt_location="ROMA" if tgt_location=="ROME"
replace tgt_location="GENOVA" if tgt_location=="GENOA"
replace tgt_location="NAPOLI" if tgt_location=="NAPLES"
replace tgt_location="LIVORNO" if tgt_location=="LEGHORN"
replace tgt_location="ISOLA DI LAMPEDUSA" if tgt_location=="LAMPEDUSA ISLAND"
replace tgt_location="APPIANO GENTILE" if tgt_location=="APPIANO"
replace tgt_location="BAGNARA CALABRA" if tgt_location=="BAGNARA"
replace tgt_location="BRESCIA" if tgt_location=="BRESCIA E M/Y"
replace tgt_location="BRESCIA" if tgt_location=="BRESCIA M/Y"
replace tgt_location="BRESCIA" if tgt_location=="BRESCIA W M/Y"
replace tgt_location="CALTANISSETTA" if tgt_location=="CALTANISETTA"
replace tgt_location="CANCELLO ED ARNONE" if tgt_location=="CANCELLO"
replace tgt_location="CANICATTÌ" if tgt_location=="CANICATTI"
replace tgt_location="CAVA DEI TIRRENI" if tgt_location=="CAVA DI TIRRENI"
replace tgt_location="FIRENZE" if tgt_location=="FLORENCE"
replace tgt_location="FORLÌ" if tgt_location=="FORLI"
replace tgt_location="PATERNÒ" if tgt_location=="PATERNO"
replace tgt_location="REGGIO CALABRIA" if tgt_location=="REGGIO DI CALABRIA"
replace tgt_location="ROMANO DI LOMBARDIA" if tgt_location=="ROMANO DI LOMBARDI"
replace tgt_location="SESTO SAN GIOVANNI" if tgt_location=="SESTO SAN GIVANNI"
replace tgt_location="VENEZIA" if tgt_location=="VENICE"
replace tgt_location="VILLA SAN GIOVANNI" if tgt_location=="VILLA S. GIOVANNI"
collapse (sum) total_tons, by(latitude longitude tgt_location)
gen One=1
collapse (sum) One, by(tgt_location)
rename tgt_location  Sede
compress Sede
replace Sede = subinstr(Sede , "(", "", .)
replace Sede = subinstr(Sede , ")", "", .)
merge m:1 Sede using "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\Comuni and Province.dta"
drop if _merge==2
drop _merge
drop if Sede==""
save "C:\Papers\New papers\John Cronyism\Italy\THOR_WWII_DATA_CLEAN2.dta", replace
clear


/*Data on Marshall plan grants from Michela Giorcelli. The data was manually matched by city and company names. In addition, keyword name searches were conducted for the receipients of the largest 250 grants*/
clear
import excel "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\Giorcelli_dati_ERP_prestiti.xlsx", sheet("Sheet1") firstrow
drop if MarshallPlanGrant==.
drop settore citta MarshallPlanGrant
collapse (sum) ammontare_prestito , by(id)
duplicates drop id, force
save "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\Giorcelli_dati.dta", replace
clear


clear
/*This file has data for public firms from 1940 thru 1945 from Taccuino*/
clear
import excel "C:\Papers\New papers\John Cronyism\Italy\Taccuino 1947 pics\TaccuinoLong.xlsx", sheet("1947") firstrow
drop  if id==.
save "C:\Papers\New papers\John Cronyism\Italy\Taccuino.dta", replace
clear

/* START HERE RUN DIRECTORS COMMANDS FIRST*/
clear
use "C:\Papers\New papers\John Cronyism\Italy\Bilanci.dta"
sort Anno id
merge 1:1 Anno id using "C:\Papers\New papers\John Cronyism\Italy\Taccuino.dta"
gen CapSocTac= CapSocLordoTacc- Posterettificacapitalesociale
replace CapSoc =CapSocTac if CapSoc==.
replace UtilePerdita =UtilePerditaTacc if UtilePerdita==.
drop CapSocLordoTacc UtilePerditaTacc CapSocTac _merge
merge 1:1 Anno id using "C:\Papers\New papers\John Cronyism\Italy\Market Capitalizations Mediobanca.dta"
drop _merge
save "C:\Papers\New papers\John Cronyism\Italy\Bilanci2.dta", replace
clear

clear
use "C:\Papers\New papers\John Cronyism\Italy\Bilanci2.dta", clear
rename AnnoFondazione AnnoFondazioneT
sort Anno id
merge 1:1 Anno id using "C:\Papers\New papers\John Cronyism\SocietaItaliane.dta"
replace AnnoFondazione=AnnoFondazioneT if AnnoFondazione==.
drop if _merge==2
drop _merge
tsset id Anno
/*this command is to backfill missing data*/
bysort id: fillmissing Ss, with(previous)
bysort id: fillmissing Ss, with(next)
bysort id: fillmissing D, with(previous)
bysort id: fillmissing D, with(next)
bysort id: fillmissing AnnoFondazione, with(previous)
bysort id: fillmissing AnnoFondazione, with(next)
bysort id: fillmissing Sede, with(previous)
bysort id: fillmissing Sede, with(next)
bysort id: fillmissing Prov, with(previous)
bysort id: fillmissing Prov, with(next)
tabulate Ss if id==31393
tabulate Sede if id==8575
tabulate Sede if id==22
tabulate Ss if id==63
gen lnAge=ln(Anno-AnnoFondazione+1)
sort id
/*Data on bombings by allied forces during 1943-1945 from THOR*/
sort Sede
merge m:1 Sede using "C:\Papers\New papers\John Cronyism\Italy\THOR_WWII_DATA_CLEAN.dta"
drop if _merge==2
drop _merge
sort Prov
merge m:1 Prov using "C:\Papers\New papers\John Cronyism\Italy\THOR_WWII_DATA_CLEAN_Province.dta"
drop if _merge==2
drop _merge
replace total_tons=0 if total_tons==.
replace total_tons_province=0 if total_tons_province==.
replace Sede=COMUNEATTUALE if COMUNEATTUALE!=""
sort Sede
merge m:1 Sede using "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\ISTAT Dati comunali e provinciali.dta"
drop if _merge==2
drop _merge
gen IntensityTonsPerKm2= total_tons/ SuperficietotaleKm2
gen total_tonsold= total_tons
drop total_tons
gen total_tons=IntensityTonsPerKm2
merge m:1 Prov using "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\ISTAT popolazione province.dta"
drop if _merge==2
drop _merge
gen IntensityTonsProvPerKm2= total_tons_province/ SuperficietotaleprovKm2
gen total_tons_provinceold= total_tons_province
drop total_tons_province
gen total_tons_province= IntensityTonsProvPerKm2
/*The following obs are dropped because the names of politicians were gathered only through 1963*/
drop if Anno>1963
sort id Anno
merge 1:1 id Anno using "C:\Papers\New papers\John Cronyism\SocietaItalianeConnectionsFirmLevel.dta"

/*this command is to backfill FascistaDeparted */
tsset id Anno
bysort id: fillmissing FascistaDepartedPFY, with(previous)
bysort id: fillmissing FascistaDepartedPFY, with(next)
bysort id: fillmissing FascistaDepartedPF, with(previous)
bysort id: fillmissing FascistaDepartedPF, with(next)
bysort id: fillmissing FascistaKeptPF, with(next)
bysort id: fillmissing FascistaKeptPF, with(previous)
/*The companies that are dropped are firms for which PCs are available in a given year but Equity is not*/

gen ConnectionDataYear=0
replace ConnectionDataYear=1 if _merge==3
drop if _merge==2
drop _merge
sort id
by id: egen Fascista= max(FascistaF)
tsset id Anno
drop After
gen After=0
replace After=1 if Anno>1943
gen FascistaAfter=Fascista*After
sort Anno
merge m:1 Anno using  "C:\Papers\New papers\John Cronyism\Italy\Cost of Living.dta"
drop if _merge==2
drop _merge

tsset id Anno
replace Obbl=0 if Obbl==.
gen Debito= Debitidiv+ Obbl
gen Lev= Debitidiv/ Attivo
gen Lev2= Debito/ Attivo
gen ROE= UtilePerdita/ CapSoc
gen tangibility= BeniMat/ Attivo
gen lnsize=ln(Attivo* Numeriindicidelcostodellavi)
gen lnequity=ln(CapSoc* Numeriindicidelcostodellavi)
gen revisedUtile= UtilePerdita* Numeriindicidelcostodellavi
gen lnmktcap=ln(MktCapMillions* Numeriindicidelcostodellavi)
gen DebitidivInfl= Debitidiv* Numeriindicidelcostodellavi
gen MBMediobanca= MktCapMillions*1000/ CapSoc
gen lnUtile=ln(revisedUtile+67541.04+1)
tsset id Anno
gen growth=ln(CapSoc/L.CapSoc)

merge 1:1 Anno id using  "C:\Papers\New papers\John Cronyism\Italy\Sole 24 Ore Stock Prices for MB Ratios.dta"
drop if _merge==2
drop _merge
gen MB=MBMediobanca
replace MB=MBSole if MB==.& PriceType==1
summarize MBSole MBMediobanca MB

winsor2 Lev ROE lnequity lnsize tangibility growth MB, cuts(1 99) replace by(Anno)
egen stROE=std(ROE)
egen stMB=std(MB)
egen stlnsize=std(lnsize)
egen stlnequity=std(lnequity)
egen sttotal_tons=std(total_tons)
drop total_tons
rename sttotal_tons total_tons
egen sttotal_tons_province=std(total_tons_province)
drop total_tons_province
rename sttotal_tons_province total_tons_province
encode Ss, generate(Ss_n)
encode Prov, generate(Prov_n)
encode Ss, generate(D_n)

bysort id: fillmissing Ss_n, with(previous)
bysort id: fillmissing Ss_n, with(next)
drop if Anno<1910|Anno>1960

gen Anno1910=0
gen Anno1911=0
gen Anno1912=0
gen Anno1913=0
gen Anno1914=0
gen Anno1915=0
gen Anno1916=0
gen Anno1917=0
gen Anno1918=0
gen Anno1919=0
gen Anno1920=0
gen Anno1921=0
gen Anno1922=0
gen Anno1923=0
gen Anno1924=0
gen Anno1925=0
gen Anno1926=0
gen Anno1927=0
gen Anno1928=0
gen Anno1929=0
gen Anno1930=0
gen Anno1931=0
gen Anno1932=0
gen Anno1933=0
gen Anno1934=0
gen Anno1935=0
gen Anno1936=0
gen Anno1937=0
gen Anno1938=0
gen Anno1939=0
gen Anno1940=0
gen Anno1941=0
gen Anno1942=0
gen Anno1943=0
gen Anno1944=0
gen Anno1945=0
gen Anno1946=0
gen Anno1947=0
gen Anno1948=0
gen Anno1949=0
gen Anno1950=0
gen Anno1951=0
gen Anno1952=0
gen Anno1953=0
gen Anno1954=0
gen Anno1955=0
gen Anno1956=0
gen Anno1957=0
gen Anno1958=0
gen Anno1959=0
gen Anno1960=0
gen Anno1961=0
gen Anno1962=0
gen Anno1963=0

gen Anno1951Plus=0
replace Anno1910=1 if Anno==1910
replace Anno1911=1 if Anno==1911
replace Anno1912=1 if Anno==1912
replace Anno1913=1 if Anno==1913
replace Anno1914=1 if Anno==1914
replace Anno1915=1 if Anno==1915
replace Anno1916=1 if Anno==1916
replace Anno1917=1 if Anno==1917
replace Anno1918=1 if Anno==1918
replace Anno1919=1 if Anno==1919
replace Anno1920=1 if Anno==1920
replace Anno1921=1 if Anno==1921
replace Anno1922=1 if Anno==1922
replace Anno1923=1 if Anno==1923
replace Anno1924=1 if Anno==1924
replace Anno1925=1 if Anno==1925
replace Anno1926=1 if Anno==1926
replace Anno1927=1 if Anno==1927
replace Anno1928=1 if Anno==1928
replace Anno1929=1 if Anno==1929
replace Anno1930=1 if Anno==1930
replace Anno1931=1 if Anno==1931
replace Anno1932=1 if Anno==1932
replace Anno1933=1 if Anno==1933
replace Anno1934=1 if Anno==1934
replace Anno1935=1 if Anno==1935
replace Anno1936=1 if Anno==1936
replace Anno1937=1 if Anno==1937
replace Anno1938=1 if Anno==1938
replace Anno1939=1 if Anno==1939
replace Anno1940=1 if Anno==1940
replace Anno1941=1 if Anno==1941
replace Anno1942=1 if Anno==1942
replace Anno1943=1 if Anno==1943
replace Anno1944=1 if Anno==1944
replace Anno1945=1 if Anno==1945
replace Anno1946=1 if Anno==1946
replace Anno1947=1 if Anno==1947
replace Anno1948=1 if Anno==1948
replace Anno1949=1 if Anno==1949
replace Anno1950=1 if Anno==1950
replace Anno1951=1 if Anno==1951
replace Anno1952=1 if Anno==1952
replace Anno1953=1 if Anno==1953
replace Anno1954=1 if Anno==1954
replace Anno1955=1 if Anno==1955
replace Anno1956=1 if Anno==1956
replace Anno1957=1 if Anno==1957
replace Anno1958=1 if Anno==1958
replace Anno1959=1 if Anno==1959
replace Anno1960=1 if Anno==1960
replace Anno1961=1 if Anno==1961
replace Anno1962=1 if Anno==1962
replace Anno1963=1 if Anno==1963

replace Anno1951Plus=1 if Anno>=1951&Anno!=.
gen Fascista1910 =Fascista*Anno1910
gen Fascista1911 =Fascista*Anno1911
gen Fascista1912 =Fascista*Anno1912
gen Fascista1913 =Fascista*Anno1913
gen Fascista1914 =Fascista*Anno1914
gen Fascista1915 =Fascista*Anno1915
gen Fascista1916 =Fascista*Anno1916
gen Fascista1917 =Fascista*Anno1917
gen Fascista1918 =Fascista*Anno1918
gen Fascista1919 =Fascista*Anno1919
gen Fascista1920 =Fascista*Anno1920
gen Fascista1921 =Fascista*Anno1921
gen Fascista1922 =Fascista*Anno1922
gen Fascista1923 =Fascista*Anno1923
gen Fascista1924 =Fascista*Anno1924
gen Fascista1925 =Fascista*Anno1925
gen Fascista1926 =Fascista*Anno1926
gen Fascista1927 =Fascista*Anno1927
gen Fascista1928 =Fascista*Anno1928
gen Fascista1929 =Fascista*Anno1929
gen Fascista1930 =Fascista*Anno1930
gen Fascista1931 =Fascista*Anno1931
gen Fascista1932 =Fascista*Anno1932
gen Fascista1933 =Fascista*Anno1933
gen Fascista1934 =Fascista*Anno1934
gen Fascista1935 =Fascista*Anno1935
gen Fascista1936 =Fascista*Anno1936
gen Fascista1937 =Fascista*Anno1937
gen Fascista1938 =Fascista*Anno1938
gen Fascista1939 =Fascista*Anno1939
gen Fascista1940 =Fascista*Anno1940
gen Fascista1941 =Fascista*Anno1941
gen Fascista1942 =Fascista*Anno1942
gen Fascista1943 =Fascista*Anno1943
gen Fascista1944 =Fascista*Anno1944
gen Fascista1945 =Fascista*Anno1945
gen Fascista1946 =Fascista*Anno1946
gen Fascista1947 =Fascista*Anno1947
gen Fascista1948 =Fascista*Anno1948
gen Fascista1949 =Fascista*Anno1949
gen Fascista1950 =Fascista*Anno1950
gen Fascista1951 =Fascista*Anno1951
gen Fascista1952 =Fascista*Anno1952
gen Fascista1953 =Fascista*Anno1953
gen Fascista1954 =Fascista*Anno1954
gen Fascista1955 =Fascista*Anno1955
gen Fascista1956 =Fascista*Anno1956
gen Fascista1957 =Fascista*Anno1957
gen Fascista1958 =Fascista*Anno1958
gen Fascista1959 =Fascista*Anno1959
gen Fascista1960 =Fascista*Anno1960
gen Fascista1961 =Fascista*Anno1961
gen Fascista1962 =Fascista*Anno1962
gen Fascista1963 =Fascista*Anno1963
gen Fascista1951Plus=Fascista*Anno1951Plus

winsor2 total_tons, cuts(1 99) replace 
gen total_tons1910 =total_tons*Anno1910
gen total_tons1911 =total_tons*Anno1911
gen total_tons1912 =total_tons*Anno1912
gen total_tons1913 =total_tons*Anno1913
gen total_tons1914 =total_tons*Anno1914
gen total_tons1915 =total_tons*Anno1915
gen total_tons1916 =total_tons*Anno1916
gen total_tons1917 =total_tons*Anno1917
gen total_tons1918 =total_tons*Anno1918
gen total_tons1919 =total_tons*Anno1919
gen total_tons1920 =total_tons*Anno1920
gen total_tons1921 =total_tons*Anno1921
gen total_tons1922 =total_tons*Anno1922
gen total_tons1923 =total_tons*Anno1923
gen total_tons1924 =total_tons*Anno1924
gen total_tons1925 =total_tons*Anno1925
gen total_tons1926 =total_tons*Anno1926
gen total_tons1927 =total_tons*Anno1927
gen total_tons1928 =total_tons*Anno1928
gen total_tons1929 =total_tons*Anno1929
gen total_tons1930 =total_tons*Anno1930
gen total_tons1931 =total_tons*Anno1931
gen total_tons1932 =total_tons*Anno1932
gen total_tons1933 =total_tons*Anno1933
gen total_tons1934 =total_tons*Anno1934
gen total_tons1935 =total_tons*Anno1935
gen total_tons1936 =total_tons*Anno1936
gen total_tons1937 =total_tons*Anno1937
gen total_tons1938 =total_tons*Anno1938
gen total_tons1939 =total_tons*Anno1939
gen total_tons1940 =total_tons*Anno1940
gen total_tons1941 =total_tons*Anno1941
gen total_tons1942 =total_tons*Anno1942
gen total_tons1943 =total_tons*Anno1943
gen total_tons1944 =total_tons*Anno1944
gen total_tons1945 =total_tons*Anno1945
gen total_tons1946 =total_tons*Anno1946
gen total_tons1947 =total_tons*Anno1947
gen total_tons1948 =total_tons*Anno1948
gen total_tons1949 =total_tons*Anno1949
gen total_tons1950 =total_tons*Anno1950
gen total_tons1951 =total_tons*Anno1951
gen total_tons1952 =total_tons*Anno1952
gen total_tons1953 =total_tons*Anno1953
gen total_tons1954 =total_tons*Anno1954
gen total_tons1955 =total_tons*Anno1955
gen total_tons1956 =total_tons*Anno1956
gen total_tons1957 =total_tons*Anno1957
gen total_tons1958 =total_tons*Anno1958
gen total_tons1959 =total_tons*Anno1959
gen total_tons1960 =total_tons*Anno1960
gen total_tons1961 =total_tons*Anno1961
gen total_tons1962 =total_tons*Anno1962
gen total_tons1963 =total_tons*Anno1963
gen total_tons1951Plus=total_tons*Anno1951Plus


winsor2 total_tons_province, cuts(1 99) replace 
gen total_tons_province1910 =total_tons_province*Anno1910
gen total_tons_province1911 =total_tons_province*Anno1911
gen total_tons_province1912 =total_tons_province*Anno1912
gen total_tons_province1913 =total_tons_province*Anno1913
gen total_tons_province1914 =total_tons_province*Anno1914
gen total_tons_province1915 =total_tons_province*Anno1915
gen total_tons_province1916 =total_tons_province*Anno1916
gen total_tons_province1917 =total_tons_province*Anno1917
gen total_tons_province1918 =total_tons_province*Anno1918
gen total_tons_province1919 =total_tons_province*Anno1919
gen total_tons_province1920 =total_tons_province*Anno1920
gen total_tons_province1921 =total_tons_province*Anno1921
gen total_tons_province1922 =total_tons_province*Anno1922
gen total_tons_province1923 =total_tons_province*Anno1923
gen total_tons_province1924 =total_tons_province*Anno1924
gen total_tons_province1925 =total_tons_province*Anno1925
gen total_tons_province1926 =total_tons_province*Anno1926
gen total_tons_province1927 =total_tons_province*Anno1927
gen total_tons_province1928 =total_tons_province*Anno1928
gen total_tons_province1929 =total_tons_province*Anno1929
gen total_tons_province1930 =total_tons_province*Anno1930
gen total_tons_province1931 =total_tons_province*Anno1931
gen total_tons_province1932 =total_tons_province*Anno1932
gen total_tons_province1933 =total_tons_province*Anno1933
gen total_tons_province1934 =total_tons_province*Anno1934
gen total_tons_province1935 =total_tons_province*Anno1935
gen total_tons_province1936 =total_tons_province*Anno1936
gen total_tons_province1937 =total_tons_province*Anno1937
gen total_tons_province1938 =total_tons_province*Anno1938
gen total_tons_province1939 =total_tons_province*Anno1939
gen total_tons_province1940 =total_tons_province*Anno1940
gen total_tons_province1941 =total_tons_province*Anno1941
gen total_tons_province1942 =total_tons_province*Anno1942
gen total_tons_province1943 =total_tons_province*Anno1943
gen total_tons_province1944 =total_tons_province*Anno1944
gen total_tons_province1945 =total_tons_province*Anno1945
gen total_tons_province1946 =total_tons_province*Anno1946
gen total_tons_province1947 =total_tons_province*Anno1947
gen total_tons_province1948 =total_tons_province*Anno1948
gen total_tons_province1949 =total_tons_province*Anno1949
gen total_tons_province1950 =total_tons_province*Anno1950
gen total_tons_province1951 =total_tons_province*Anno1951
gen total_tons_province1952 =total_tons_province*Anno1952
gen total_tons_province1953 =total_tons_province*Anno1953
gen total_tons_province1954 =total_tons_province*Anno1954
gen total_tons_province1955 =total_tons_province*Anno1955
gen total_tons_province1956 =total_tons_province*Anno1956
gen total_tons_province1957 =total_tons_province*Anno1957
gen total_tons_province1958 =total_tons_province*Anno1958
gen total_tons_province1959 =total_tons_province*Anno1959
gen total_tons_province1960 =total_tons_province*Anno1960
gen total_tons_province1961 =total_tons_province*Anno1961
gen total_tons_province1962 =total_tons_province*Anno1962
gen total_tons_province1963 =total_tons_province*Anno1963
gen total_tons_province1951Plus=total_tons_province*Anno1951Plus


gen Anno1924thru1943=0
replace Anno1924thru1943=1 if Anno>=1924&Anno<=1943
gen Fascista1924thru1943=Fascista* Anno1924thru1943

sort Ss
egen sottosettore = group(Ss)
sort id
merge m:1 id using "C:\Papers\New papers\John Cronyism\Italy\WW2 bombings\Giorcelli_dati.dta"
drop if _merge==2
drop _merge
tsset id T
gen shock= max(FascistSenatorFAfter, FascistDeputyFAfter)
gen shock2= max(IneligibleFAfter, FascistDeputyFAfter)
replace ammontare_prestito=0 if ammontare_prestito==.
gen MarshallPlanGrant =ln(ammontare_prestito +1)
gen MarshallPlanGrantPost1948= MarshallPlanGrant
replace MarshallPlanGrantPost1948=0 if Anno<1948
gen total_tons1945After= total_tons
replace total_tons1945After =0 if Anno<1945
gen total_tons_province1945After = total_tons_province
replace total_tons_province1945After =0 if Anno<1945
gen total_tons19431950= total_tons
replace total_tons19431950=0 if Anno<1943|Anno>1950
gen Fascista1921Plus=Fascista
replace Fascista1921Plus=0 if Anno<1921
gen Fascista19441950= FascistaAfter
replace Fascista19441950=0 if Anno>1950


gen Post1917=0
replace Post1917=1 if Anno>=1917
gen FascistaPost1917=Fascista*Post1917
gen ConnectedPreWW1=NumberConn if Anno==1913
replace ConnectedPreWW1=NumberConn if Anno==1911&ConnectedPreWW1==.
replace ConnectedPreWW1=1 if ConnectedPreWW1>0&ConnectedPreWW1<100
tabulate ConnectedPreWW1
bysort id: fillmissing ConnectedPreWW1, with(max)
replace ConnectedPreWW1=0 if ConnectedPreWW1==.
summarize ConnectedPreWW1
corr ConnectedPreWW1 Fascista

gen ConnectedPreWW11917Plus= ConnectedPreWW1* Post1917
gen ConnectedPreWW1After=ConnectedPreWW1*After

sort Provincia
merge m:1 Provincia using "C:\Papers\New papers\John Cronyism\Italy\EconomicDevelopment1931B.dta"
drop if _merge==2
drop _merge
sort Regione
merge m:1 Regione using "C:\Papers\New papers\John Cronyism\Italy\EconomicDevelopment1931A.dta"
drop if _merge==2
drop _merge
save "C:\Papers\New papers\John Cronyism\Italy\Bilanci3.dta", replace
clear

clear
import excel "C:\Papers\New papers\John Cronyism\Italy\Taccuino Wide Janet 09-13-2024 Checked.xlsx", sheet("Sheet2") firstrow
drop if id==.
sort id Anno
keep id Anno AttivoTaccuino UtileesercizioTaccuino CapitalesocialeTaccuino
save "C:\Papers\New papers\John Cronyism\Italy\Taccuino Wide Janet 09-13-2024 Checked.dta", replace
clear
